﻿{extend name="public:base" /}{block name="css"}
<link href="/static/laydate/theme/default/laydate.css">
<style>
    .video-preview {
        min-width: 200px;
    }
</style>
{/block}
{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>打卡日期</th>
                                <th>打卡天数</th>
                                <th>打卡视频</th>
                                <th>打卡图片</th>
                                <th>是否超期</th>
                                <th>是否打款</th>
                                <th>状态</th>
                                <th>驳回原因</th>
                                <th>打卡时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.ck_date}</td>
                                <td>{$vo.day}</td>
                                <td>
                                    <div class="video-preview">
                                        {volist name="$vo.video" id="v"}
                                        <video preload="none" controls style="max-width: 200px; max-height: 150px; margin-bottom: 10px;" src="{$v}"></video>
                                        {/volist}
                                    </div>
                                </td>
                                <td>
                                    {volist name="$vo.imgs" id="v"}
                                    <div class="form-uploaded-img-box">
                                        <img class="form-uploaded-box-img" src="{$v.path}" data-text="{$v.text}">
                                        <i class="form-uploaded-img-preview iconfont icon-yulan" onclick="previewImg(this, 'form-uploaded-img-preview', '', '{$vo.imgs_text_json}')"></i>
                                    </div>
                                    {/volist}
                                </td>
                                <td>{$vo.is_over ? '是' : '否'}</td>
                                <td>{$vo.is_pay ? '已打款' : '未打款'}</td>
                                <td>{$vo.status_text}</td>
                                <td>{$vo.remark}</td>
                                <td>{:timeFormat($vo.ck_time, 'Y-m-d H:i')}</td>
                                <td class="project-actions">
                                    {if $vo.status == 1}
                                    <a href="{:url(agreeUserClockStatus, ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-success"></i> 通过 </a>
                                    <a href="{:url(refuseUserClockStatus, ['id' => $vo.id])}" class="btn btn-white btn-sm" onclick="setId(`{$vo.id}`)" data-toggle="modal" data-target="#refuse"><i class="iconfont icon-refuse"></i> 驳回 </a>
                                    {elseif $vo.status == 2}
                                    <a href="{:url(exportClock, ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-folder"></i> 生成打卡记录
                                    </a>
                                    {/if}
                                    {if $vo.zip_download_url}
                                    <a href="{$vo.zip_download_url}" class="btn btn-white btn-sm"><i class="iconfont icon-success"></i> 下载打卡记录 </a>
                                    {/if}
                                    {if $vo.is_pay == 0 && $vo.status == 2}
                                    <a href="{:url(doUserClockPay, ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-tixian"></i> 已打款
                                    </a>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>

                </div>
            </div>
        </div>
    </div>

    <div class="modal inmodal" id="refuse" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated flipInY">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">驳回</h4>
                </div>
                <div class="modal-body">
                    <input type="text" class="form-control remark" placeholder="请输入驳回原因">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white close-model" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="confirmRefuse">确认修改</button>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/preview-img-mask" swiper-id="cropper-preview" /}
{/block}

{block name="js"}
<script src="/static/laydate/laydate.js"></script>
<script>
    laydate.render({
        elem: '.screen-date', //指定元素
        format: 'yyyy-MM-dd',
        range: true
    });

    var id = 0;

    function setId(row_id) {
        id = row_id
    }

    $('#confirmRefuse').click(function () {
        var remark = $('.remark').val();
        var url = "/admin/manage/refuseUserClockStatus";

        $.post(url, {
            id, remark
        }, function (res) {
            layer.msg(res.msg)
            if (res.result == 1) {
                $(".close-model").trigger("click");
                setTimeout(() => {
                    window.location.reload()
                }, 500)
            }
        }, 'json')
    })
</script>{/block}

